﻿using System;
using System.Collections.Generic;
using System.Text;
using Manso.cBot.Common;

namespace Manso.cBot.DefaultModules.Core
{
    public class AclRemoveCommand : ICommand
    {
        private ListenToEnum _listenTo;
        private string _command;
        private string _help;
        private string _usage;
        private AccessControlLevel _accessLevel;


        public AclRemoveCommand()
        {
            _listenTo = ListenToEnum.Tell;
            _command = "AclRemove";
            _help = "Remove a character from the access control list of cBot";
            _usage = "aclremove character_name";
            _accessLevel = AccessControlLevel.Owner;
        }

        public ListenToEnum ListenTo
        {
            get { return _listenTo; }
        }

        public string Command
        {
            get { return _command; }
        }

        public string Help
        {
            get { return _help; }
        }

        public string Usage
        {
            get { return _usage; }
        }

        public AccessControlLevel AccessLevel
        {
            get { return _accessLevel; }
        }

        public void ExecuteCommand(string[] args, string executedBy, ListenToEnum listenTo)
        {
            if (args.Length != 1 || args[0].Length <= 0)
            {
                cBotContext.Instance.SendPrivateMessage(executedBy,
                                                        "Invalid arguments, try help aclremove for usage information");
                return;
            }

            cBotContext.Instance.AccessControl.Remove(args[0]);
            cBotContext.Instance.SendPrivateMessage(executedBy, "User has been removed succefully");
        }
    }
}
